﻿using Cool.EntityFramework.Core.Interceptor;
using Furion;
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.DependencyInjection;

namespace Cool.EntityFramework.Core
{
    public class Startup : AppStartup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDatabaseAccessor(options =>
            {
                options.AddDbPool<DefaultDbContext>(DbProvider.MySql, interceptors: new IInterceptor[] {
                    new CoolSqlCommandProfilerInterceptor()
                });
                options.AddDbPool<MultiTenantDbContext, MultiTenantDbContextLocator>(DbProvider.MySql);
            }, "Cool.Database.Migrations");
        }
    }
}